package cn.itcast.service.impl;

import cn.itcast.dao.StandardDao;
import cn.itcast.domain.Standard;
import cn.itcast.service.StandardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Service
public class StandardServiceImpl implements StandardService {

    @Autowired
    private StandardDao  standardDao;

    /**
     * 用户添加
     * @param standard
     */
    @Override
    public void save(Standard standard) {
        standardDao.save(standard);


    }

    /**
     * 分页查询
     * @param page
     * @param rows
     * @return
     */

    @Override
    public Page<Standard> pageQuery(int page, int rows) {
        PageRequest pageList = PageRequest.of(page-1, rows);
        return standardDao.findAll(pageList);
    }


    @Override
   public  List<Standard> findAll(){

     return   standardDao.findAll();
   }


}
